package reamodel.diagram.providers;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.notation.View;

import reamodel.diagram.edit.parts.CommitmentAgentEditPart;
import reamodel.diagram.edit.parts.CommitmentResourceEditPart;
import reamodel.diagram.edit.parts.DecrementCommitmentEditPart;
import reamodel.diagram.edit.parts.DecrementCommitmentFulfillEditPart;
import reamodel.diagram.edit.parts.DecrementCommitmentNameEditPart;
import reamodel.diagram.edit.parts.DecrementCommitmentSpecifyEditPart;
import reamodel.diagram.edit.parts.DecrementEconomicEventEditPart;
import reamodel.diagram.edit.parts.DecrementEconomicEventNameEditPart;
import reamodel.diagram.edit.parts.DecrementEconomicEventTypeEditPart;
import reamodel.diagram.edit.parts.DecrementEconomicEventTypeNameEditPart;
import reamodel.diagram.edit.parts.DecrementEconomicEventTypeTypifyEditPart;
import reamodel.diagram.edit.parts.DualityLabelEditPart;
import reamodel.diagram.edit.parts.DualityTypeLabelEditPart;
import reamodel.diagram.edit.parts.EconomicAgentEditPart;
import reamodel.diagram.edit.parts.EconomicAgentNameEditPart;
import reamodel.diagram.edit.parts.EconomicAgentTypeEditPart;
import reamodel.diagram.edit.parts.EconomicAgentTypeNameEditPart;
import reamodel.diagram.edit.parts.EconomicAgentTypeTypifyEditPart;
import reamodel.diagram.edit.parts.EconomicResourceEditPart;
import reamodel.diagram.edit.parts.EconomicResourceInflowLabelEditPart;
import reamodel.diagram.edit.parts.EconomicResourceNameEditPart;
import reamodel.diagram.edit.parts.EconomicResourceOutflowLabelEditPart;
import reamodel.diagram.edit.parts.EconomicResourceTypeEditPart;
import reamodel.diagram.edit.parts.EconomicResourceTypeNameEditPart;
import reamodel.diagram.edit.parts.EconomicResourceTypeTypifyEditPart;
import reamodel.diagram.edit.parts.FulfillLabel2EditPart;
import reamodel.diagram.edit.parts.FulfillLabelEditPart;
import reamodel.diagram.edit.parts.IncrementCommitmentEditPart;
import reamodel.diagram.edit.parts.IncrementCommitmentFulfillEditPart;
import reamodel.diagram.edit.parts.IncrementCommitmentNameEditPart;
import reamodel.diagram.edit.parts.IncrementCommitmentReciprocityEditPart;
import reamodel.diagram.edit.parts.IncrementCommitmentSpecifyEditPart;
import reamodel.diagram.edit.parts.IncrementEconomicEventDualityEditPart;
import reamodel.diagram.edit.parts.IncrementEconomicEventEditPart;
import reamodel.diagram.edit.parts.IncrementEconomicEventNameEditPart;
import reamodel.diagram.edit.parts.IncrementEconomicEventTypeDualityTypeEditPart;
import reamodel.diagram.edit.parts.IncrementEconomicEventTypeEditPart;
import reamodel.diagram.edit.parts.IncrementEconomicEventTypeNameEditPart;
import reamodel.diagram.edit.parts.IncrementEconomicEventTypeTypifyEditPart;
import reamodel.diagram.edit.parts.InflowEditPart;
import reamodel.diagram.edit.parts.InflowNameEditPart;
import reamodel.diagram.edit.parts.InflowTypeEditPart;
import reamodel.diagram.edit.parts.InflowTypeLabelEditPart;
import reamodel.diagram.edit.parts.InflowTypeNameEditPart;
import reamodel.diagram.edit.parts.OutflowEditPart;
import reamodel.diagram.edit.parts.OutflowNameEditPart;
import reamodel.diagram.edit.parts.OutflowTypeEditPart;
import reamodel.diagram.edit.parts.OutflowTypeLabelEditPart;
import reamodel.diagram.edit.parts.OutflowTypeNameEditPart;
import reamodel.diagram.edit.parts.ProvideLabelEditPart;
import reamodel.diagram.edit.parts.ProvideParticipationEditPart;
import reamodel.diagram.edit.parts.ProvideParticipationNameEditPart;
import reamodel.diagram.edit.parts.REAModelEditPart;
import reamodel.diagram.edit.parts.ReceiveLabelEditPart;
import reamodel.diagram.edit.parts.ReceiveParticipationEditPart;
import reamodel.diagram.edit.parts.ReceiveParticipationNameEditPart;
import reamodel.diagram.edit.parts.ReciprocityLabelEditPart;
import reamodel.diagram.edit.parts.SpecifyLabel2EditPart;
import reamodel.diagram.edit.parts.SpecifyLabel3EditPart;
import reamodel.diagram.edit.parts.SpecifyLabel4EditPart;
import reamodel.diagram.edit.parts.SpecifyLabelEditPart;
import reamodel.diagram.edit.parts.TypifyLabel2EditPart;
import reamodel.diagram.edit.parts.TypifyLabel3EditPart;
import reamodel.diagram.edit.parts.TypifyLabel4EditPart;
import reamodel.diagram.edit.parts.TypifyLabelEditPart;
import reamodel.diagram.part.REAmetamodelVisualIDRegistry;
import reamodel.diagram.view.factories.CommitmentAgentViewFactory;
import reamodel.diagram.view.factories.CommitmentResourceViewFactory;
import reamodel.diagram.view.factories.DecrementCommitmentFulfillViewFactory;
import reamodel.diagram.view.factories.DecrementCommitmentNameViewFactory;
import reamodel.diagram.view.factories.DecrementCommitmentSpecifyViewFactory;
import reamodel.diagram.view.factories.DecrementCommitmentViewFactory;
import reamodel.diagram.view.factories.DecrementEconomicEventNameViewFactory;
import reamodel.diagram.view.factories.DecrementEconomicEventTypeNameViewFactory;
import reamodel.diagram.view.factories.DecrementEconomicEventTypeTypifyViewFactory;
import reamodel.diagram.view.factories.DecrementEconomicEventTypeViewFactory;
import reamodel.diagram.view.factories.DecrementEconomicEventViewFactory;
import reamodel.diagram.view.factories.DualityLabelViewFactory;
import reamodel.diagram.view.factories.DualityTypeLabelViewFactory;
import reamodel.diagram.view.factories.EconomicAgentNameViewFactory;
import reamodel.diagram.view.factories.EconomicAgentTypeNameViewFactory;
import reamodel.diagram.view.factories.EconomicAgentTypeTypifyViewFactory;
import reamodel.diagram.view.factories.EconomicAgentTypeViewFactory;
import reamodel.diagram.view.factories.EconomicAgentViewFactory;
import reamodel.diagram.view.factories.EconomicResourceInflowLabelViewFactory;
import reamodel.diagram.view.factories.EconomicResourceNameViewFactory;
import reamodel.diagram.view.factories.EconomicResourceOutflowLabelViewFactory;
import reamodel.diagram.view.factories.EconomicResourceTypeNameViewFactory;
import reamodel.diagram.view.factories.EconomicResourceTypeTypifyViewFactory;
import reamodel.diagram.view.factories.EconomicResourceTypeViewFactory;
import reamodel.diagram.view.factories.EconomicResourceViewFactory;
import reamodel.diagram.view.factories.FulfillLabel2ViewFactory;
import reamodel.diagram.view.factories.FulfillLabelViewFactory;
import reamodel.diagram.view.factories.IncrementCommitmentFulfillViewFactory;
import reamodel.diagram.view.factories.IncrementCommitmentNameViewFactory;
import reamodel.diagram.view.factories.IncrementCommitmentReciprocityViewFactory;
import reamodel.diagram.view.factories.IncrementCommitmentSpecifyViewFactory;
import reamodel.diagram.view.factories.IncrementCommitmentViewFactory;
import reamodel.diagram.view.factories.IncrementEconomicEventDualityViewFactory;
import reamodel.diagram.view.factories.IncrementEconomicEventNameViewFactory;
import reamodel.diagram.view.factories.IncrementEconomicEventTypeDualityTypeViewFactory;
import reamodel.diagram.view.factories.IncrementEconomicEventTypeNameViewFactory;
import reamodel.diagram.view.factories.IncrementEconomicEventTypeTypifyViewFactory;
import reamodel.diagram.view.factories.IncrementEconomicEventTypeViewFactory;
import reamodel.diagram.view.factories.IncrementEconomicEventViewFactory;
import reamodel.diagram.view.factories.InflowNameViewFactory;
import reamodel.diagram.view.factories.InflowTypeLabelViewFactory;
import reamodel.diagram.view.factories.InflowTypeNameViewFactory;
import reamodel.diagram.view.factories.InflowTypeViewFactory;
import reamodel.diagram.view.factories.InflowViewFactory;
import reamodel.diagram.view.factories.OutflowNameViewFactory;
import reamodel.diagram.view.factories.OutflowTypeLabelViewFactory;
import reamodel.diagram.view.factories.OutflowTypeNameViewFactory;
import reamodel.diagram.view.factories.OutflowTypeViewFactory;
import reamodel.diagram.view.factories.OutflowViewFactory;
import reamodel.diagram.view.factories.ProvideLabelViewFactory;
import reamodel.diagram.view.factories.ProvideParticipationNameViewFactory;
import reamodel.diagram.view.factories.ProvideParticipationViewFactory;
import reamodel.diagram.view.factories.REAModelViewFactory;
import reamodel.diagram.view.factories.ReceiveLabelViewFactory;
import reamodel.diagram.view.factories.ReceiveParticipationNameViewFactory;
import reamodel.diagram.view.factories.ReceiveParticipationViewFactory;
import reamodel.diagram.view.factories.ReciprocityLabelViewFactory;
import reamodel.diagram.view.factories.SpecifyLabel2ViewFactory;
import reamodel.diagram.view.factories.SpecifyLabel3ViewFactory;
import reamodel.diagram.view.factories.SpecifyLabel4ViewFactory;
import reamodel.diagram.view.factories.SpecifyLabelViewFactory;
import reamodel.diagram.view.factories.TypifyLabel2ViewFactory;
import reamodel.diagram.view.factories.TypifyLabel3ViewFactory;
import reamodel.diagram.view.factories.TypifyLabel4ViewFactory;
import reamodel.diagram.view.factories.TypifyLabelViewFactory;

/**
 * @generated
 */
public class REAmetamodelViewProvider extends AbstractViewProvider {

	/**
	 * @generated
	 */
	protected Class getDiagramViewClass(IAdaptable semanticAdapter,
			String diagramKind) {
		EObject semanticElement = getSemanticElement(semanticAdapter);
		if (REAModelEditPart.MODEL_ID.equals(diagramKind)
				&& REAmetamodelVisualIDRegistry
						.getDiagramVisualID(semanticElement) != -1) {
			return REAModelViewFactory.class;
		}
		return null;
	}

	/**
	 * @generated
	 */
	protected Class getNodeViewClass(IAdaptable semanticAdapter,
			View containerView, String semanticHint) {
		if (containerView == null) {
			return null;
		}
		IElementType elementType = getSemanticElementType(semanticAdapter);
		EObject domainElement = getSemanticElement(semanticAdapter);
		int visualID;
		if (semanticHint == null) {
			// Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy.
			// In this situation there should be NO elementType, visualID will be determined
			// by VisualIDRegistry.getNodeVisualID() for domainElement.
			if (elementType != null || domainElement == null) {
				return null;
			}
			visualID = REAmetamodelVisualIDRegistry.getNodeVisualID(
					containerView, domainElement);
		} else {
			visualID = REAmetamodelVisualIDRegistry.getVisualID(semanticHint);
			if (elementType != null) {
				// Semantic hint is specified together with element type.
				// Both parameters should describe exactly the same diagram element.
				// In addition we check that visualID returned by VisualIDRegistry.getNodeVisualID() for
				// domainElement (if specified) is the same as in element type.
				if (!REAmetamodelElementTypes.isKnownElementType(elementType)
						|| (!(elementType instanceof IHintedType))) {
					return null; // foreign element type
				}
				String elementTypeHint = ((IHintedType) elementType)
						.getSemanticHint();
				if (!semanticHint.equals(elementTypeHint)) {
					return null; // if semantic hint is specified it should be the same as in element type
				}
				if (domainElement != null
						&& visualID != REAmetamodelVisualIDRegistry
								.getNodeVisualID(containerView, domainElement)) {
					return null; // visual id for node EClass should match visual id from element type
				}
			} else {
				// Element type is not specified. Domain element should be present (except pure design elements).
				// This method is called with EObjectAdapter as parameter from:
				//   - ViewService.createNode(View container, EObject eObject, String type, PreferencesHint preferencesHint) 
				//   - generated ViewFactory.decorateView() for parent element
				if (!REAModelEditPart.MODEL_ID
						.equals(REAmetamodelVisualIDRegistry
								.getModelID(containerView))) {
					return null; // foreign diagram
				}
				switch (visualID) {
				case EconomicResourceTypeEditPart.VISUAL_ID:
				case EconomicAgentTypeEditPart.VISUAL_ID:
				case DecrementEconomicEventTypeEditPart.VISUAL_ID:
				case IncrementEconomicEventTypeEditPart.VISUAL_ID:
				case EconomicAgentEditPart.VISUAL_ID:
				case EconomicResourceEditPart.VISUAL_ID:
				case DecrementEconomicEventEditPart.VISUAL_ID:
				case IncrementEconomicEventEditPart.VISUAL_ID:
				case IncrementCommitmentEditPart.VISUAL_ID:
				case DecrementCommitmentEditPart.VISUAL_ID:
					if (domainElement == null
							|| visualID != REAmetamodelVisualIDRegistry
									.getNodeVisualID(containerView,
											domainElement)) {
						return null; // visual id in semantic hint should match visual id for domain element
					}
					break;
				case EconomicResourceTypeNameEditPart.VISUAL_ID:
					if (EconomicResourceTypeEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case EconomicAgentTypeNameEditPart.VISUAL_ID:
					if (EconomicAgentTypeEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case DecrementEconomicEventTypeNameEditPart.VISUAL_ID:
					if (DecrementEconomicEventTypeEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case IncrementEconomicEventTypeNameEditPart.VISUAL_ID:
					if (IncrementEconomicEventTypeEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case EconomicAgentNameEditPart.VISUAL_ID:
					if (EconomicAgentEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case EconomicResourceNameEditPart.VISUAL_ID:
					if (EconomicResourceEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case DecrementEconomicEventNameEditPart.VISUAL_ID:
					if (DecrementEconomicEventEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case IncrementEconomicEventNameEditPart.VISUAL_ID:
					if (IncrementEconomicEventEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case IncrementCommitmentNameEditPart.VISUAL_ID:
					if (IncrementCommitmentEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case DecrementCommitmentNameEditPart.VISUAL_ID:
					if (DecrementCommitmentEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case TypifyLabelEditPart.VISUAL_ID:
					if (EconomicResourceTypeTypifyEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case OutflowNameEditPart.VISUAL_ID:
				case EconomicResourceOutflowLabelEditPart.VISUAL_ID:
					if (OutflowEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case InflowNameEditPart.VISUAL_ID:
				case EconomicResourceInflowLabelEditPart.VISUAL_ID:
					if (InflowEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case TypifyLabel2EditPart.VISUAL_ID:
					if (DecrementEconomicEventTypeTypifyEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case TypifyLabel3EditPart.VISUAL_ID:
					if (IncrementEconomicEventTypeTypifyEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case OutflowTypeNameEditPart.VISUAL_ID:
				case OutflowTypeLabelEditPart.VISUAL_ID:
					if (OutflowTypeEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case InflowTypeNameEditPart.VISUAL_ID:
				case InflowTypeLabelEditPart.VISUAL_ID:
					if (InflowTypeEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case TypifyLabel4EditPart.VISUAL_ID:
					if (EconomicAgentTypeTypifyEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case ReceiveParticipationNameEditPart.VISUAL_ID:
				case ReceiveLabelEditPart.VISUAL_ID:
					if (ReceiveParticipationEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case ProvideParticipationNameEditPart.VISUAL_ID:
				case ProvideLabelEditPart.VISUAL_ID:
					if (ProvideParticipationEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case DualityLabelEditPart.VISUAL_ID:
					if (IncrementEconomicEventDualityEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case DualityTypeLabelEditPart.VISUAL_ID:
					if (IncrementEconomicEventTypeDualityTypeEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case SpecifyLabelEditPart.VISUAL_ID:
					if (CommitmentAgentEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case SpecifyLabel2EditPart.VISUAL_ID:
					if (CommitmentResourceEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case FulfillLabelEditPart.VISUAL_ID:
					if (IncrementCommitmentFulfillEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case FulfillLabel2EditPart.VISUAL_ID:
					if (DecrementCommitmentFulfillEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case ReciprocityLabelEditPart.VISUAL_ID:
					if (IncrementCommitmentReciprocityEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case SpecifyLabel3EditPart.VISUAL_ID:
					if (DecrementCommitmentSpecifyEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				case SpecifyLabel4EditPart.VISUAL_ID:
					if (IncrementCommitmentSpecifyEditPart.VISUAL_ID != REAmetamodelVisualIDRegistry
							.getVisualID(containerView)
							|| containerView.getElement() != domainElement) {
						return null; // wrong container
					}
					break;
				default:
					return null;
				}
			}
		}
		return getNodeViewClass(containerView, visualID);
	}

	/**
	 * @generated
	 */
	protected Class getNodeViewClass(View containerView, int visualID) {
		if (containerView == null
				|| !REAmetamodelVisualIDRegistry.canCreateNode(containerView,
						visualID)) {
			return null;
		}
		switch (visualID) {
		case EconomicResourceTypeEditPart.VISUAL_ID:
			return EconomicResourceTypeViewFactory.class;
		case EconomicResourceTypeNameEditPart.VISUAL_ID:
			return EconomicResourceTypeNameViewFactory.class;
		case EconomicAgentTypeEditPart.VISUAL_ID:
			return EconomicAgentTypeViewFactory.class;
		case EconomicAgentTypeNameEditPart.VISUAL_ID:
			return EconomicAgentTypeNameViewFactory.class;
		case DecrementEconomicEventTypeEditPart.VISUAL_ID:
			return DecrementEconomicEventTypeViewFactory.class;
		case DecrementEconomicEventTypeNameEditPart.VISUAL_ID:
			return DecrementEconomicEventTypeNameViewFactory.class;
		case IncrementEconomicEventTypeEditPart.VISUAL_ID:
			return IncrementEconomicEventTypeViewFactory.class;
		case IncrementEconomicEventTypeNameEditPart.VISUAL_ID:
			return IncrementEconomicEventTypeNameViewFactory.class;
		case EconomicAgentEditPart.VISUAL_ID:
			return EconomicAgentViewFactory.class;
		case EconomicAgentNameEditPart.VISUAL_ID:
			return EconomicAgentNameViewFactory.class;
		case EconomicResourceEditPart.VISUAL_ID:
			return EconomicResourceViewFactory.class;
		case EconomicResourceNameEditPart.VISUAL_ID:
			return EconomicResourceNameViewFactory.class;
		case DecrementEconomicEventEditPart.VISUAL_ID:
			return DecrementEconomicEventViewFactory.class;
		case DecrementEconomicEventNameEditPart.VISUAL_ID:
			return DecrementEconomicEventNameViewFactory.class;
		case IncrementEconomicEventEditPart.VISUAL_ID:
			return IncrementEconomicEventViewFactory.class;
		case IncrementEconomicEventNameEditPart.VISUAL_ID:
			return IncrementEconomicEventNameViewFactory.class;
		case IncrementCommitmentEditPart.VISUAL_ID:
			return IncrementCommitmentViewFactory.class;
		case IncrementCommitmentNameEditPart.VISUAL_ID:
			return IncrementCommitmentNameViewFactory.class;
		case DecrementCommitmentEditPart.VISUAL_ID:
			return DecrementCommitmentViewFactory.class;
		case DecrementCommitmentNameEditPart.VISUAL_ID:
			return DecrementCommitmentNameViewFactory.class;
		case TypifyLabelEditPart.VISUAL_ID:
			return TypifyLabelViewFactory.class;
		case OutflowNameEditPart.VISUAL_ID:
			return OutflowNameViewFactory.class;
		case EconomicResourceOutflowLabelEditPart.VISUAL_ID:
			return EconomicResourceOutflowLabelViewFactory.class;
		case InflowNameEditPart.VISUAL_ID:
			return InflowNameViewFactory.class;
		case EconomicResourceInflowLabelEditPart.VISUAL_ID:
			return EconomicResourceInflowLabelViewFactory.class;
		case TypifyLabel2EditPart.VISUAL_ID:
			return TypifyLabel2ViewFactory.class;
		case TypifyLabel3EditPart.VISUAL_ID:
			return TypifyLabel3ViewFactory.class;
		case OutflowTypeNameEditPart.VISUAL_ID:
			return OutflowTypeNameViewFactory.class;
		case OutflowTypeLabelEditPart.VISUAL_ID:
			return OutflowTypeLabelViewFactory.class;
		case InflowTypeNameEditPart.VISUAL_ID:
			return InflowTypeNameViewFactory.class;
		case InflowTypeLabelEditPart.VISUAL_ID:
			return InflowTypeLabelViewFactory.class;
		case TypifyLabel4EditPart.VISUAL_ID:
			return TypifyLabel4ViewFactory.class;
		case ReceiveParticipationNameEditPart.VISUAL_ID:
			return ReceiveParticipationNameViewFactory.class;
		case ReceiveLabelEditPart.VISUAL_ID:
			return ReceiveLabelViewFactory.class;
		case ProvideParticipationNameEditPart.VISUAL_ID:
			return ProvideParticipationNameViewFactory.class;
		case ProvideLabelEditPart.VISUAL_ID:
			return ProvideLabelViewFactory.class;
		case DualityLabelEditPart.VISUAL_ID:
			return DualityLabelViewFactory.class;
		case DualityTypeLabelEditPart.VISUAL_ID:
			return DualityTypeLabelViewFactory.class;
		case SpecifyLabelEditPart.VISUAL_ID:
			return SpecifyLabelViewFactory.class;
		case SpecifyLabel2EditPart.VISUAL_ID:
			return SpecifyLabel2ViewFactory.class;
		case FulfillLabelEditPart.VISUAL_ID:
			return FulfillLabelViewFactory.class;
		case FulfillLabel2EditPart.VISUAL_ID:
			return FulfillLabel2ViewFactory.class;
		case ReciprocityLabelEditPart.VISUAL_ID:
			return ReciprocityLabelViewFactory.class;
		case SpecifyLabel3EditPart.VISUAL_ID:
			return SpecifyLabel3ViewFactory.class;
		case SpecifyLabel4EditPart.VISUAL_ID:
			return SpecifyLabel4ViewFactory.class;
		}
		return null;
	}

	/**
	 * @generated
	 */
	protected Class getEdgeViewClass(IAdaptable semanticAdapter,
			View containerView, String semanticHint) {
		IElementType elementType = getSemanticElementType(semanticAdapter);
		if (!REAmetamodelElementTypes.isKnownElementType(elementType)
				|| (!(elementType instanceof IHintedType))) {
			return null; // foreign element type
		}
		String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
		if (elementTypeHint == null) {
			return null; // our hint is visual id and must be specified
		}
		if (semanticHint != null && !semanticHint.equals(elementTypeHint)) {
			return null; // if semantic hint is specified it should be the same as in element type
		}
		int visualID = REAmetamodelVisualIDRegistry
				.getVisualID(elementTypeHint);
		EObject domainElement = getSemanticElement(semanticAdapter);
		if (domainElement != null
				&& visualID != REAmetamodelVisualIDRegistry
						.getLinkWithClassVisualID(domainElement)) {
			return null; // visual id for link EClass should match visual id from element type
		}
		return getEdgeViewClass(visualID);
	}

	/**
	 * @generated
	 */
	protected Class getEdgeViewClass(int visualID) {
		switch (visualID) {
		case EconomicResourceTypeTypifyEditPart.VISUAL_ID:
			return EconomicResourceTypeTypifyViewFactory.class;
		case OutflowEditPart.VISUAL_ID:
			return OutflowViewFactory.class;
		case InflowEditPart.VISUAL_ID:
			return InflowViewFactory.class;
		case DecrementEconomicEventTypeTypifyEditPart.VISUAL_ID:
			return DecrementEconomicEventTypeTypifyViewFactory.class;
		case IncrementEconomicEventTypeTypifyEditPart.VISUAL_ID:
			return IncrementEconomicEventTypeTypifyViewFactory.class;
		case OutflowTypeEditPart.VISUAL_ID:
			return OutflowTypeViewFactory.class;
		case InflowTypeEditPart.VISUAL_ID:
			return InflowTypeViewFactory.class;
		case EconomicAgentTypeTypifyEditPart.VISUAL_ID:
			return EconomicAgentTypeTypifyViewFactory.class;
		case ReceiveParticipationEditPart.VISUAL_ID:
			return ReceiveParticipationViewFactory.class;
		case ProvideParticipationEditPart.VISUAL_ID:
			return ProvideParticipationViewFactory.class;
		case IncrementEconomicEventDualityEditPart.VISUAL_ID:
			return IncrementEconomicEventDualityViewFactory.class;
		case IncrementEconomicEventTypeDualityTypeEditPart.VISUAL_ID:
			return IncrementEconomicEventTypeDualityTypeViewFactory.class;
		case CommitmentAgentEditPart.VISUAL_ID:
			return CommitmentAgentViewFactory.class;
		case CommitmentResourceEditPart.VISUAL_ID:
			return CommitmentResourceViewFactory.class;
		case IncrementCommitmentFulfillEditPart.VISUAL_ID:
			return IncrementCommitmentFulfillViewFactory.class;
		case DecrementCommitmentFulfillEditPart.VISUAL_ID:
			return DecrementCommitmentFulfillViewFactory.class;
		case IncrementCommitmentReciprocityEditPart.VISUAL_ID:
			return IncrementCommitmentReciprocityViewFactory.class;
		case DecrementCommitmentSpecifyEditPart.VISUAL_ID:
			return DecrementCommitmentSpecifyViewFactory.class;
		case IncrementCommitmentSpecifyEditPart.VISUAL_ID:
			return IncrementCommitmentSpecifyViewFactory.class;
		}
		return null;
	}

	/**
	 * @generated
	 */
	private IElementType getSemanticElementType(IAdaptable semanticAdapter) {
		if (semanticAdapter == null) {
			return null;
		}
		return (IElementType) semanticAdapter.getAdapter(IElementType.class);
	}
}
